package com.doupi.partner.util;

import java.util.ArrayList;
import java.util.List;

/**
 * datatable数据封装
 * 
 * @param <T>
 */
public class DataTableData<T> {

	private int draw;

	private int recordsTotal;

	private int recordsFiltered;

	private List<T> data = new ArrayList<>();

	public DataTableData() {

	}

	public DataTableData(Pagination<?, T> page) {
		this(page.getTotalCount(), page.getRecords());
	}

	public DataTableData(int draw, int recordsTotal, int recordsFiltered, List<T> data) {
		super();
		this.draw = draw;
		this.recordsTotal = recordsTotal;
		this.recordsFiltered = recordsFiltered;
		this.data = data;
	}

	public DataTableData(int draw, int recordsTotal, List<T> data) {
		super();
		this.draw = draw;
		this.recordsTotal = recordsTotal;
		this.recordsFiltered = recordsTotal;
		this.data = data;
	}

	public DataTableData(int recordsTotal, List<T> data) {
		super();
		this.draw = 0;
		this.recordsTotal = recordsTotal;
		this.recordsFiltered = recordsTotal;
		this.data = data;
	}

	public int getDraw() {
		return draw;
	}

	public void setDraw(int draw) {
		this.draw = draw;
	}

	public int getRecordsTotal() {
		return recordsTotal;
	}

	public void setRecordsTotal(int recordsTotal) {
		this.recordsTotal = recordsTotal;
	}

	public int getRecordsFiltered() {
		return recordsFiltered;
	}

	public void setRecordsFiltered(int recordsFiltered) {
		this.recordsFiltered = recordsFiltered;
	}

	public List<T> getData() {
		return data;
	}

	public void setData(List<T> data) {
		this.data = data;
	}
}
